Skip to content

Fix webview view badge not clearing when set to undefined - #331019

Open
Hadley Wickham (hadley) wants to merge 1 commit into
microsoft:mainfrom
hadley:fix/webview-view-badge-clear
Open

Fix webview view badge not clearing when set to undefined#331019
Hadley Wickham (hadley) wants to merge 1 commit into
microsoft:mainfrom
hadley:fix/webview-view-badge-clear

Conversation

@hadley

Copy link
Copy Markdown

Problem

WebviewViewPane.updateBadge registers the view activity (the numeric badge on the view container) when a badge is assigned, but never disposes it when the badge is set back to undefined. The badge therefore stays visible on the activity bar after the extension has cleared it.

The tree view badge setter in src/vs/workbench/browser/parts/views/treeView.ts handles this correctly with an else { this._activity.clear(); } branch; the webview view pane is missing the equivalent.

Repro: from an extension, set webviewView.badge = { value: 1, tooltip: '...' } on a registered webview view, then set webviewView.badge = undefined. The badge remains visible.

Fix

Add the missing else branch to clear the registered activity when the badge becomes undefined, mirroring the tree view implementation.

WebviewViewPane.updateBadge registers the view activity when a badge is
assigned but never disposes it when the badge is set back to undefined,
so the badge stays visible on the view container after the extension
clears it. The tree view badge setter already handles this with an
else branch that clears the activity; add the same here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes stale webview view badges by clearing the registered activity when a badge is removed.

Changes:

  • Clears webview view activity when its badge becomes undefined.
  • Aligns badge handling with tree views.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants